package com.xc.xcrpc.protocol;

import lombok.Getter;

/**
 * 协议消息的状态枚举
 *
 * @author zqx
 * @since 2024/9/27
 */
@Getter
public enum ProtocolMessageStatusEnum {

    OK("ok" ,20),
    BAD_REQUEST("badRequest",40),
    BAD_RESPONSE("badResponse",50);

    private final String text;

    private final int value;

    ProtocolMessageStatusEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    public static ProtocolMessageStatusEnum getEnumByValue(int value){
        for (ProtocolMessageStatusEnum anEnum : ProtocolMessageStatusEnum.values()) {
            if (anEnum.value == value){
                return anEnum;
            }
        }
        return null;
    }


}
